home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / New System Software Extensions / QuickDraw™ GX v1.0ß2 / Interfaces & Libraries / interfaces / layout library.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-29  |  3.8 KB  |  124 lines  |  [TEXT/MPS ]

  1. /* layout library.h -- Line Layout support routines. */
  2.  
  3. /* Copyright ©1990, 1991, 1992 Apple Computer, Inc.  All rights reserved. */
  4.  
  5. #ifndef layoutLibraryIncludes
  6. #define layoutLibraryIncludes
  7.  
  8. #ifndef graphicsRoutinesIncludes
  9. #include "graphics routines.h"
  10. #endif
  11.  
  12. #ifndef layoutTypesIncludes
  13. #include "layout types.h"
  14. #endif
  15.  
  16. typedef struct {
  17.   gxPriorityJustificationOverride *priorityJustOverride;
  18.   gxGlyphJustificationOverride    *glyphJustOverrides;
  19.   long                          glyphJustOverridesCount;
  20.   gxGlyphSubstitution             *glyphSubstitutions;
  21.   long                          glyphSubstitutionsCount;
  22.   gxKerningAdjustment             *kerningAdjustments;
  23.   long                          kerningAdjustmentsCount;
  24. } StyleRunOverrides;
  25.  
  26. typedef struct {
  27.   short nLayouts;
  28.   fixed totalHeight;
  29.   gxShape layouts[];
  30. } ParagraphRecord, **ParagraphRecordHandle;
  31.  
  32. typedef struct {
  33.   gxRunFeatureType  featureType;
  34.   unsigned short  nSelectors;
  35.   unsigned short  selectorTableOffset;
  36.   short           nameIndex;
  37. } RunFeatureTypeName;
  38.  
  39. typedef struct {
  40.   gxRunFeatureSelector  featureSelector;
  41.   short               nameIndex;
  42. } RunFeatureSelectorName;
  43.  
  44. void InitializeRunControls (gxRunControls *runControls);
  45.  
  46. void InitializeLayoutOptions (gxLayoutOptions *layoutOptions);
  47.  
  48. void InitializeStyleRunOverrides (StyleRunOverrides *overrides);
  49.  
  50. void SetDefaultPriorityJustOverride (gxPriorityJustificationOverride *override);
  51.  
  52. void SetLayoutStyle (
  53.   gxStyle             s,
  54.   char              *gxFontName,
  55.   fixed             textSize,
  56.   gxTextAttribute     attr,
  57.   gxRunControls       *runControls,
  58.   gxRunFeature        runFeatures[],
  59.   long              runFeaturesCount,
  60.   StyleRunOverrides *overrides);
  61.  
  62. gxStyle NewLayoutStyle (
  63.   char              *gxFontName,
  64.   fixed             textSize,
  65.   gxTextAttribute     attr,
  66.   gxRunControls       *runControls,
  67.   gxRunFeature        runFeatures[],
  68.   long              runFeaturesCount,
  69.   StyleRunOverrides *overrides);
  70.  
  71. gxShape NewSingleLayout (
  72.   char              *text,
  73.   char              *gxFontName,
  74.   fixed             textSize,
  75.   gxLayoutOptions     *options,
  76.   gxPoint             *position,
  77.   gxTextAttribute     attr,
  78.   gxRunControls       *runControls,
  79.   gxRunFeature        runFeatures[],
  80.   long              runFeaturesCount,
  81.   StyleRunOverrides *overrides);
  82.  
  83. /* The following functions provide a limited paragraph-creation function. They make calls
  84.     to GetWidthArray and do simple gxLine-breaking using the obtained widths.
  85.     
  86.     !!! IMPORTANT NOTE FOLLOWS !!!
  87.     
  88.     These functions need to be able to deal with text in multiple scripts, which might
  89.     contain zero bytes. Therefore calls that determine hard stops (such as NewParagraph)
  90.     do NOT stop at zero bytes; this means that just passing in a single C string is NOT
  91.     sufficient! Callers will need to add a carriage return themselves to the end of the
  92.     text source. */
  93.  
  94. ParagraphRecordHandle NewParagraph(
  95.   char    *text,
  96.   gxStyle   baseStyle,
  97.   fixed   width,
  98.   long    justified,      /* really a boolean; this way for compiler difference reasons */
  99.   fixed   lineHeight,     /* if zero, we will deduce */
  100.   gxPoint   *firstOrigin);  /* origin of first gxLine in paragraph */
  101.  
  102. ParagraphRecordHandle NewStyledParagraph(
  103.   long                textRunCount,
  104.   const void          *text[],
  105.   const short         textRunLengths[],
  106.   long                styleRunCount,
  107.   const gxStyle         styles[],
  108.   const short         styleRunLengths[],
  109.   long                levelRunCount,
  110.   const short         levels[],
  111.   const short         levelRunLengths[],
  112.   long                totalByteCount,
  113.   const gxLayoutOptions *layoutOptions,
  114.   fixed               lineHeight,
  115.   const gxPoint         *firstOrigin);
  116.  
  117. void DisposeParagraph(ParagraphRecordHandle paraRec);
  118.  
  119. /* GetLayoutBounds can be used to return the bounds of a layout. */
  120.  
  121. gxShape GetLayoutBounds(gxShape layout);
  122.  
  123. #endif
  124.